/* 
 * File:   Task.cpp
 * Author: Nicolas Proust & Pierre-Antoine Jahan
 * 
 * Created on 22 janvier 2013, 16:40
 */

#include <string.h>

#include "Task.h"
Task::Task(string title, bool isOrdo, int nombre, bool isEcheance, bool fixe,  Date d, int relat) : titre_(title), ordo_(isOrdo), number_(nombre), ech_(isEcheance), fixe_(fixe), date_(d), relat_(relat)  {}
Task::Task(string title, bool isOrdo, int nombre, bool isEcheance, bool fixe) : titre_(title), ordo_(isOrdo), number_(nombre), ech_(isEcheance), fixe_(fixe)  {}

Task::~Task() {
}

void Task::setNumber(int number) {
    this->number_ = number;
}

int Task::getNumber() const {
    return number_;
}

void Task::setOrdo(bool ordo) {
    this->ordo_ = ordo;
}

bool Task::isOrdo() const {
    return ordo_;
}

void Task::setDate(Date d){
    this->date_ = d;
}

Date Task::getDate() const {
    return date_;
}

void Task::setTitre(string titre) {
    this->titre_ = titre;
}

string Task::getTitre() const {
    return titre_;
}

void Task::setEcheance(bool ech) {
    this->ech_ = ech;
}

bool Task::isEcheance() const {
    return ech_;
}

void Task::setFixe(bool f) {
    this->fixe_ = f;
}

bool Task::isFixe() const {
    return fixe_;
}

void Task::setRelative(int relat) {
    this->relat_ = relat;
}

int Task::getRelative() const {
    return relat_;
}

bool Task::isChecked() const {
    return checked_;
}
    
void Task::setChecked(bool checked) {
    this->checked_=checked;
}

list<Task*> Task::getTasks() const{
    return tasksList;
}

//Gestion de la liste des taches
void Task::addTask(Task* t) {
    tasksList.push_back(t);
}

void Task::removeTask(Task* t) {
    tasksList.remove(t);
}

int operator==(Task const &a, Task const &b) {
    if(a.getTitre()==b.getTitre()) return true;
    else return false;
}

bool orderByNumber(Task& t1, Task& t2){

    if(t1.getNumber()<t2.getNumber()) {
        return true;
    }
    else {
        return false;
    }
        
}

bool operator < (const Task& a, const Task& b)
{
  return a.getNumber() < b.getNumber();
}